import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from 'vite-plugin-windicss'
import path from "path"
// https://vitejs.dev/config/
export default defineConfig({
  resolve:{alias:{"~":path.resolve(__dirname,"src")}},
  plugins: [vue(),WindiCSS(
  //     {
  //   scan: {
  //     dirs: ['.'], // 当前目录下所有文件
  //     fileExtensions: ['vue', 'js', 'ts'], // 同时启用扫描vue/js/ts
  //   },
  // }
  )],
  server: {
    host: '0.0.0.0',
    port: 9090,
    proxy: {
      //本地设置
      '/spkc': {
        target: 'http://127.0.0.1:8089/',	//实际请求地址
        changeOrigin: true,
        secure: true,                   //是否https接口
        rewrite: (path) => path.replace(/^\/spkc/, 'spkc')
        // pathRewrite: {'^/api': "captcha/captchaImage"}
      },
      // // 外网设置
      // '/free': {
      //   // https://www.tianqiapi.com/free/day?appid=23035354&appsecret=8YvlPNrz
      //   target: 'https://www.tianqiapi.com/', //实际请求地址
      //   changeOrigin: true,
      //   secure: true,                   //是否https接口
      //   rewrite: (path) => path.replace(/^\/free/, 'free')
      //   // pathRewrite: {'^/api': "captcha/captchaImage"}
      //   },
    }
  }
})
